#include <string>
#include "platinum.h"

namespace Platinum{
		/**
		*	Error objects contain both a message and an error code and are thrown by misc exceptions
		*/
		Error::Error(int code, std::string msg) : errCode(code), errMessage(msg){}

		/**
		* strtocharp takes a std::string and returns a pointer to type char or char*
		* The purpose of this function is to ease dealing with legacy interfaces that insist on char* that can be modified
		* Please make sure to free the buffer returned by this as soon as you are done with it, otherwise you will leak memory!
		*/ 
		char* strtocharp(std::string Data)
		{
			#ifdef DEBUG
				std::cout << "strtocharp has been called!  Make sure you are freeing the buffer created here as soon as you are done with it, otherwise you will leak memory!" << std::endl;
			#endif
			
			char *buf = new char[Data.length()+1];
			strcpy(buf, Data.c_str());
			return(buf);
		}


}
